<template>
  <div class="store-info">
    <div class="return" @click="goBack">
      <Icon size="25" color="#000000" name="arrow-left" class="back" />
      <div class="title">
        <p class="text">宝贝</p>
      </div>
    </div>
      <product-card-row :products="products"></product-card-row>
  </div>
</template>

<script>
import {Icon} from 'vant';
import ProductCardRow from "@/components/ProductCardRow.vue";
import http from "@/plugins/http";

export default {
  props: {
    supplierId: {
      type: Number,
      required: true // 表示这个 prop 是必需的
    }
  },
  mounted() {
    this.loadPage()
  },
  data(){
    return{
      products:[],
    }
  },
  name:"storeInfo",
  components: {
    Icon,
    ProductCardRow,
  },
  methods: {
    goBack() {
      this.$router.go(-1);
    },
    loadPage(){
      let v = this;
      console.log(v.supplierId)
      http.get('/product/getByShopId/'+v.supplierId).then(res=>{
        if(res.statusCode==='200')
        {
          console.log(res.data)
          this.products=res.data;
        }
      })
    }
  }
};
</script>

<style>
/* 按钮样式 */
.enter-btn {
  background-color: #FFA500; /* 橙色背景 */
  border: none;
  color: white;
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
  border-radius: 5px;
  width: 100%;
  text-align: center;
}

.return {
  background-color: white;
  padding: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.back {
  position: absolute;
  left: 10px;
  text-decoration: none;
}

.title {
  display: flex;
  align-items: center;
}

.text {
  margin: 0;
  color: #000000;
  font-size: 16px;
}
.store-info {
  padding: 16px 16px 200px;
}
.container {
  display: flex;
  align-items: flex-start; /* 让内容顶部对齐 */
}
</style>
